﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;

namespace Vision.AlgBase
{
    /// <summary>
    /// 指令相关数据，包括指令的导出特性以及输入和输出
    /// 保存到XML文件中
    /// </summary>
    [Serializable]
    public class ServiceMetaData : ICloneable
    {
        #region 构造函数
        public ServiceMetaData(IAlg service)
        {
            if (null == service)
                throw new ArgumentNullException("service");
            StepService = service;
        }

        private ServiceMetaData() { }
        #endregion 构造函数

        #region 公有属性
        /// <summary>
        /// 指令名称
        /// </summary>
        public string SeriveName
        {
            get { return seriveName; }
            set { seriveName = value; }
        }
        private string seriveName = string.Empty;

        /// <summary>
        /// 指令描述
        /// </summary>
        public string Descri
        {
            get { return descri; }
            set { descri = value; }
        }
        private string descri = string.Empty;

        [XmlIgnore]
        public IAlg StepService { get; private set; }

        #endregion 公有属性

        object ICloneable.Clone()
        {
            return Clone();
        }

        public ServiceMetaData Clone()
        {
            ServiceMetaData meta = new ServiceMetaData
            {
                seriveName = seriveName,
                descri = descri,
                StepService= StepService
            };
            return meta;
        }
    }
}
